<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Compose Message</title>
</head>
<body>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/composeMessage.js"></script>

<%@ page import="tuna.Process" %>
<%
	String day = request.getParameter("day");
	String us = request.getParameter("us");
	String role = request.getParameter("role");
	String id = request.getParameter("id");
	String senderId = request.getParameter("senderId");
	String senderUtorId = request.getParameter("senderUtorId");
		
	if(Process.validate(day, us, role, id)) {
		if(senderId == null) {
			senderId = "";
		}
		
		if(senderUtorId == null) {
			senderUtorId = "";
		}
%>
	<table align="center" style="font-family: arial; width: 480px;">
		<tr>
			<td>
				To:
			</td>
			<td>
				<input type="text" class="text" id="receiver" size="25" value="<%= senderUtorId %>"/>
			</td>
		</tr>
		<tr>
			<td colspan=2>
				<textarea id="messageBox" style="width: 95%;"></textarea>
			</td>
		</tr>
		<tr>
			<td>
				<div id="status"></div>
			</td>
			<td>
				<input type="button" value="Send" onclick="sendMessage('<%= us %>', '<%= id %>');"/>
			</td>
		</tr>
	</table>
<% 
	}
	else {
		response.sendRedirect("/tuna/login.jsp");
	}
%>
</body>
</html>